-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Delete template from storage pool instantly if no volume is using it #11782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.20
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 4.20 #11782 +/- ##
============================================
- Coverage 16.17% 16.17% -0.01%
+ Complexity 13298 13297 -1
============================================
Files 5656 5656
Lines 498242 498282 +40
Branches 60458 60466 +8
============================================
+ Hits 80584 80590 +6
- Misses 408686 408722 +36
+ Partials 8972 8970 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@blueorangutan package |
@abh1sar a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
server/src/main/java/com/cloud/template/TemplateManagerImpl.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm
thanks @abh1sar
@blueorangutan package |
@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ debian. SL-JID 15274 |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15276 |
@blueorangutan test |
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-14517)
|
+ "will validate if the provided URL is resolvable during the register of templates/ISOs before persisting them in the database.", | ||
true); | ||
|
||
ConfigKey<Boolean> TemplateDeleteFromPrimaryStorage = new ConfigKey<Boolean>("Advanced", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abh1sar do we really need a global setting for this usecase, I think we can directly delete the template if there is no usage found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harikrishna-patnala I added it as a failsafe or in case someone doesn't care about how faster the space is reclaimed, but doesn't want to risk any kind of data loss. Also in case someone wants to use the setting storage.template.cleanup.enabled=false
or storage.cleanup.enabled=false
where the deleted template is never cleaned up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality to immediately delete template files from primary storage when templates are deleted, controlled by a new configuration setting. The feature helps prevent storage accumulation of unused template files by proactively evicting them during template deletion operations.
- Introduces
template.delete.from.primary.storage
configuration key to toggle instant template deletion from primary storage - Refactors template usage checking logic into reusable method
templateIsUnusedInPool()
- Adds new method
evictTemplateFromStoragePoolsForZones()
to delete templates from specific zones
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
TemplateManagerImpl.java | Core implementation of template eviction logic with new configuration key |
HypervisorTemplateAdapter.java | Integration of eviction calls during template deletion workflow |
PrimaryDataStoreDaoImpl.java | Database layer support for querying storage pools by data center IDs |
PrimaryDataStoreDao.java | Interface addition for data center-based pool queries |
VMTemplatePoolDaoImpl.java | Database implementation for querying template-pool relationships |
VMTemplatePoolDao.java | Interface addition for template-pool relationship queries |
TemplateManager.java | Interface definitions for new template eviction functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Description
This PR fixes #10688
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
template.delete.from.primary.storage
setting togglezoneId
zoneId=zoneA
How did you try to break this feature and the system with this change?